
library(testthat)
library(rClr)
clrInit(TRUE)
# Load the library with the C# part of things.
source('~/src/r2clr/packages/rClr/inst/tests/test.r')

testObj = clrNew(testClassName)

obj_or_type = testObj
rootMemberName ='IntegerOne'
staticPrefix=''


fieldName <- paste(staticPrefix, 'Field', rootMemberName, sep='')
propName <- paste(staticPrefix, 'Property', rootMemberName, sep='')
clrGet(obj_or_type, fieldName)
clrSet(obj_or_type, fieldName, as.integer(2))
expect_that(clrGet(obj_or_type, fieldName), equals(2))
expect_that(clrGet(obj_or_type, propName), equals(0))
clrSet(obj_or_type, propName, as.integer(2))
expect_that(clrGet(obj_or_type, propName), equals(2))
  }
  # first object members
  testObj = clrNew(testClassName)
  f(testObj, 'IntegerOne', staticPrefix='')
  # then test static members
  f(testClassName, 'IntegerOne', staticPrefix='Static')
})

library(rClr) ; clrInit() ; library(testthat) 
test_package('rClr')

